<?php

/*

  Action	$3

  +3 Cards; +1 Action
  Discard 3 cards.

 */

class Warehouse extends Card implements iAction, iKingdom, iSeaside {

    public function __construct() {
        parent::__construct("Warehouse", 3);
        $this->undoPlay = false;
        $this->undoBuy = true;
    }

    public function getDescription() {
        return array(
            "+3 Cards",
            "+1 Action",
            "Discard 3 cards.");
    }
    
    public function play(Game $game, $isRealCard) {
        $drawed_cards = $game->drawCards(3);
        $game->addActions(1);
         ScreenDisplay::addScreenMessage($game, true, "draw " . nicePrint($drawed_cards), "draws " . sizeof($drawed_cards) . " cards");

        $playHand = $game->getPlayHand();
        if (sizeof($playHand) > 3) {

            $output = MySocket::GetUserReply($game, Input_ChooseMany, $playHand, 3, 3, null, "Choose 3 cards to discard");
             ScreenDisplay::addScreenMessage($game, false, " and discard " . nicePrint($output), " and discards " . sizeof($output) . " cards");

            foreach ($output as $card_name) {
                $game->moveCardFromPileToPile($card_name, PlayHand, DiscardPile);
            }
        } else {
            $game->discardPlayHand();
        }
        $game->cardActionFinished();
        return true;
    }

}

?>